package com.atguigu.system.service.impl;

import com.atguigu.system.mapper.InventoryFlowMapper;
import com.atguigu.system.model.entity.InventoryFlow;
import com.atguigu.system.service.InventoryFlowService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 
 * @since 2025-03-01
 */
@Service
public class InventoryFlowServiceImpl extends ServiceImpl<InventoryFlowMapper, InventoryFlow> implements InventoryFlowService {

    @Override
    public Page<InventoryFlow> pageQuery(Page<InventoryFlow> page, String operatorName, String operationType, Integer inventoryId) {
        LambdaQueryWrapper<InventoryFlow> queryWrapper = new LambdaQueryWrapper<>();
        if (operatorName != null && !operatorName.trim().isEmpty()) {
            queryWrapper.like(InventoryFlow::getOperatorName, operatorName);
        }
        if (operationType != null && !operationType.trim().isEmpty()) {
            queryWrapper.like(InventoryFlow::getOperationType, operationType);
        }
        if (inventoryId != null) {
            queryWrapper.eq(InventoryFlow::getInventoryId, inventoryId);
        }
        return baseMapper.selectPage(page, queryWrapper);
    }
}
